import React, { Component } from 'react'

export default class Test extends Component {
  render() {
    return <div>Test</div>
  }
  componentWillUnmount() {
    console.log('componentWillUnmount')
    // 清理定时器
    clearInterval(this.timer)
    // 解绑事件
  }
  componentDidMount() {
    // this => 实例
    this.timer = setInterval(() => {
      console.log(1)
    }, 1000)
  }
}
